package exchange

import (
	"banzhuan/models"
)

//交易对循环套利组合
func GetAsset() ([]models.SchedulingIndex,[]models.Price){
	price_data:=GetContracts()
	//log.Println("price_data==============",price_data)
	schedulingIndex:=models.SchedulingIndex{}
	schedulingIndexArg:=[]models.SchedulingIndex{}
	for i:=0;i<(len(price_data)) ;i++  {
		switch price_data[i].BaseName {
		case "BTC","USDT","ETH":
			//step_1=price_data[i].Symbol
			step_1_count:=i
			//log.Println("step_1",step_1,"step_1_count",step_1_count)
			for j:=0;j<len(price_data) && j!=step_1_count ;j++ {
				if price_data[j].CoinName==price_data[step_1_count].CoinName && j!=step_1_count{
					//step_2=price_data[j].Symbol
					step_2_count:=j
					for k:=0 ;k<len(price_data); k++ {
						if k!=step_2_count {
							step_1_symbol:=price_data[step_1_count].BaseName+price_data[step_2_count].BaseName
							step_2_symbol:=price_data[step_2_count].BaseName+price_data[step_1_count].BaseName
							switch price_data[k].Symbol {
							case step_1_symbol,step_2_symbol:
								//log.Println("k.....",k)
								//step_3=price_data[k].Symbol
								//log.Println("step_3",step_1,step_2,step_3,"step_3_count",step_1_count,step_2_count,k)
								schedulingIndex.Step1Index=step_1_count
								schedulingIndex.Step2Index=step_2_count
								schedulingIndex.Step3Index=k
								schedulingIndexArg=append(schedulingIndexArg,schedulingIndex)
							}
						}
					}
				}
			}
		}

	}
	return schedulingIndexArg,price_data
}